class Director {
    private static instance: Director = null;
    public ctx: Main = null;

    public static getInstance() {
        if (Director.instance == null) {
            Director.instance = new Director();
        }
        return Director.instance;
    }

    public init(ctx: Main) {
        this.ctx = ctx;
    }

    public pushScene(scene: egret.DisplayObject) {
        if (this.ctx != null && scene != null) {
            this.ctx.addChild(scene);
        }
    }

    public replaceScene(scene: egret.DisplayObject) {
        if (this.ctx != null && scene != null) {
            this.ctx.removeChildren();
            this.ctx.addChild(scene);
        }
    }
}
